<div class="section">

	<div class="section-title">
    	<?php echo $breadcrumb?>
    </div>
    
    <div class="section-content padding1">
    
    	<form id="ProductForm" name="ProductForm"  action="" method="post" enctype="multipart/form-data">
    
    	<div class="left">
            
            <h3><?php echo $this->document->text['text_product']?></h3>
        
        </div>
        
    	<div class="right">
            <input class="button" type="button" value="<?php echo $this->document->text['button_save']?>" onclick="saveProduct()"/>
            <a class="button" href="<?php echo $DIR_CANCEL?>"><?php echo $this->document->text['button_cancel']?></a>
             <input type="hidden" id="status" name="status" value="<?php echo $status?>" />
             <input type="hidden" id="mediaid" name="mediaid" value="<?php echo $mediaid?>" />
             <input type="hidden" id="refersitemap" name="refersitemap" value="<?php echo $_GET['sitemapid']?>" />
        </div>
        <div class="clearer">&nbsp;</div>
        
        
        <div id="container">

            <div id="fragment-1">
            	
                <div> 
                	<p>
                        <label>Category</label><br>
                        <span id="category"></span>
                    </p>                       
                    <p>
                        <label>Product name</label><br>
                        
                        <textarea id="title" name="title"><?php echo $title?></textarea>
                    (*)</p> 

                    <p>
                        <label><?php echo $this->document->text['text_price']?></label><br>
                        <input class="text2 number" type="text" id="price" name="price" value="<?php echo $this->string->numberFormate($price)?>" size="60" />
                    </p>
                    <p>
                        <label><?php echo $this->document->text['text_unit']?></label><br>
                        <input class="text2" type="text" id="unit" name="unit" value="<?php echo $unit?>" size="60" />
                    </p>
                    <!--<p>
                        <label>Summary</label><br>
                        <textarea class="textarea2" rows="3" cols="70" id="summary" name="summary"><?php echo $summary?></textarea>
                    </p>      -->              
                </div>
                
            </div>
           
        
        </div>
        
        </form>
    
    </div>

</div>
<script language="javascript">

function saveProduct()
{
	var oEditor = CKEDITOR.instances['title'] ;
	var pageValue = oEditor.getData();
	$('textarea#title').val(pageValue);
	//$.blockUI({ message: "<h1>Please wait...</h1>" }); 
	$.post("?route=soft/product/save", 
		   $("#ProductForm").serialize(),
		   function(data)
		   {
			   if(data=="true")
					window.location='?route=soft/product&sitemapid=<?php echo $_GET["sitemapid"]?>';
				else
				{
					alert("Error! Please check your input data!");
					$.unblockUI(); 
				}
			}
		   );
		
	
}

function selectCategory(sitemapid,str,pos)
{
	$("#refersitemap").val(sitemapid);
}

$(document).ready(function() {
	setCKEditorType('title',4);
	
  	$(".number").keyup(function (e)
		{
			num = formateNumber($(this).val().replace(/,/g,""));
			$(this).val(num)
		});
	$(".number").keypress(function (e)
		{
			
		  return isNumber(e.which);
		});
	$("#category").load("?route=common/combobox/comboboxCategory&select=<?php echo $_GET['sitemapid']?>&index=0");
	
});
</script>